<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="requisitionlineList" @selection-change="handleSelectionChange">
      <el-table-column label="序号"  type="index" width="60"/>
      <el-table-column label="物料编码" align="center" prop="itemCode" />
      <el-table-column label="物料名称" align="center" prop="itemName" />
      <el-table-column label="规格型号" align="center" prop="specification" />
      <el-table-column label="单位" align="center" prop="unitOfMeasure" />
      <el-table-column label="领料数量" align="center" prop="quantityIssued" />
      <el-table-column label="批次号" align="center" prop="batchCode" />
      <el-table-column label="仓库" align="center" prop="warehouseName" />
      <el-table-column label="库区" align="center" prop="locationName" />
      <el-table-column label="库位" align="center" prop="areaName" />
      <el-table-column label="备注" align="center" prop="remark" />
    </el-table>

<!--    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />-->
  </div>
</template>

<script>
import {
  getLineList
} from "@/api/mes/rr/requisitionline";
import StockSelect from "@/components/stockSelect/single.vue";

export default {
  name: "Requisitionline",
  components: {StockSelect},
  props: {
    orderId: null,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 返修领料单体表格数据
      requisitionlineList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        // pageNum: 1,
        // pageSize: 10,
        orderId:this.orderId,
        itemCode: null,        itemName: null,      },
      // 表单参数
      form: {},
    };
  },
  created() {
    console.log("createtttttt",this.requisitionlineList)
    this.getList();
  },
  methods: {

    /** 查询返修领料单体列表 */
    getList() {
      console.log("ggggg",this.orderId)
      if(this.orderId){
        this.loading = true;
        getLineList(this.queryParams).then(response => {
          this.requisitionlineList = response.data;
          // this.total = response.total;
          this.loading = false;

        });
      }else{
        this.loading = false
      }

    },

    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,        orderId: null,        materialStockId: null,        itemId: null,        itemCode: null,        itemName: null,        specification: null,        unitOfMeasure: null,        quantityIssued: null,        batchCode: null,        warehouseId: null,        warehouseCode: null,        warehouseName: null,        locationId: null,        locationCode: null,        locationName: null,        areaId: null,        areaCode: null,        areaName: null,        remark: null,        createBy: null,        createTime: null,        createByName: null,        updateBy: null,        updateTime: null,        tenantId: null      };
      this.resetForm("form");

    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },



  }
};
</script>
